#include "FFMpegWindow.h"

FFMpegWindow::FFMpegWindow(QWidget* parent)
	: QMainWindow(parent)
{
	this->resize(QSize(320, 480));
	this->setWindowTitle("FFMPEG");
	this->setWindowIcon(QIcon("images/opencv.png"));
	createListView();
}

void FFMpegWindow::createListView() {
	listView = new CommonListView(this);
	connect(listView, &CommonListView::itemClicked, [=](QListWidgetItem* item) {
		CommonListViewItem* item2 = dynamic_cast<CommonListViewItem*>(item);
		qDebug() << "itemPos:" << item2->mPos;
		switch (item2->mPos) {
			//case 1://简单的视频播放器
			//	fFMpegSamplePlayerWindow.show();
			//	break;
			//case 2://解封装
			//	fFMpegDemuxerWindow.show();
			//	break;
			//case 3://读取yuv数据并用opengl渲染
			//	xVideoWindow.show();
			//	break;
			//case 4://简单的播放器，带封装的
			//	xVideoPlayerWindow.show();
			//	break;
		case 5://xplayer
			xPlay2.show();
			break;
		case 6://封装
			fFMpegRecordInterfaceWindow.show();
			break;
		case 7://rtmp推流
			rtmpPusherWindow.show();
			break;
		case 8://opencv rtsp to rtmp push stream
			openCVRtspToRtmpWindow.show();
			break;
		case 9://利用qt录制音频
			useQtRecordAudioWindow.show();
			break;
		case 10://ffmpeg + rtmp+audio push
			rtmpPushAudioUseFFmpegWindow.show();
			break;
		case 11:
			rgbToMp4Window.show();
			break;
		case 12:
			mediaFormatFactoryWindow.show();
			break;
		case 13:
			pcm2AacWindow.show();
			break;
		case 14:
			rGBPcm2Mp4Window.show();
			break;
		case 15:
			tonyCaptureScreenTestWindow = new TonyCaptureScreenTestWindow();
			tonyCaptureScreenTestWindow->show();
			break;
		case 16:
			audioRecordWindow.show();
			break;
		case 17:
			xScreenWindow.show();
			break;
		case 18://
			pixelFormatConversionToolWindow = new PixelFormatConversionToolWindow();
			pixelFormatConversionToolWindow->show();
			break;
		case 19://
			generateH26XWindow = new GenerateH26XWindow();
			generateH26XWindow->show();
			break;
		case 20://H264或H265文件播放器
			h264OrH265FilePlayWindow = new H264OrH265FilePlayWindow();
			h264OrH265FilePlayWindow->show();
			break;
		case 21:
			h264OrH265FilePlayByEncapsulationWindow = new H264OrH265FilePlayByEncapsulationWindow();
			h264OrH265FilePlayByEncapsulationWindow->show();
			break;
		case 22:
			deMuxerAndPlayWindow = new DeMuxerAndPlayWindow();
			deMuxerAndPlayWindow->show();
			break;
		case 23:
			rePackingMp4Window = new RePackingMp4Window();
			rePackingMp4Window->show();
			break;
		case 24:
			rePackingMp4ByFormatCodeWindow = new RePackingMp4ByFormatCodeWindow();
			rePackingMp4ByFormatCodeWindow->show();
			break;
		case 25:
			transcodingWindow = new TranscodingWindow();
			transcodingWindow->show();
			break;
		case 26:
			testWindow = new TestWindow();
			testWindow->show();
			break;
		case 27:
			playAndRecordRTSPStreamWindow = new PlayAndRecordRTSPStreamWindow();
			playAndRecordRTSPStreamWindow->show();
			break;
		case 28:
			multiChannelMonitoringWindow = new MultiChannelMonitoringWindow();
			multiChannelMonitoringWindow->show();
			break;
		}
		});
	/*new CommonListViewItem("FFMPEG播放器", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 1, listView);
	new CommonListViewItem("FFMPEG解封装", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 2, listView);
	new CommonListViewItem("读取yuv数据并用OpenGL渲染", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 3, listView);
	new CommonListViewItem("ffmpeg+opengl简单的播放器", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 4, listView);*/
	new CommonListViewItem("xplayer", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 5, listView);
	new CommonListViewItem("FFmpeg rtsp 转rtmp推流", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 6, listView);
	new CommonListViewItem("FFmpeg Rtmp推流（从文件中推流）", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 7, listView);
	new CommonListViewItem("利用OpenCV将rtsp流转rtmp并推送至服务器", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 8, listView);
	new CommonListViewItem("利用Qt录制音频小案例", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 9, listView);
	new CommonListViewItem("FFmpeg_rtmp_audio推流", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 10, listView);
	new CommonListViewItem("RGB转MP4", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 11, listView);
	new CommonListViewItem("媒体文件格式工厂", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 12, listView);
	new CommonListViewItem("PCM转AAC", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 13, listView);
	new CommonListViewItem("RGB PCM转MP4", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 14, listView);
	new CommonListViewItem("directx屏幕抓取", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 15, listView);
	new CommonListViewItem("Qt音频录制", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 16, listView);
	new CommonListViewItem("录屏软件", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 17, listView);
	new CommonListViewItem("像素格式转换工具", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 18, listView);
	new CommonListViewItem("录屏后将数据存储成H264或H265", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 19, listView);
	new CommonListViewItem("H264或H265文件播放器", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 20, listView);
	new CommonListViewItem("H264或H265文件播放器(封装)", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 21, listView);
	new CommonListViewItem("解封装后解码渲染", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 22, listView);
	new CommonListViewItem("重新封装Mp4（如果是网络流可用于录制）", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 23, listView);
	new CommonListViewItem("重新封装Mp4（如果是网络流可用于录制）->对基础代码做了封装", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 24, listView);
	new CommonListViewItem("综合案例之视频转码", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 25, listView);
	new CommonListViewItem("测试OpenGL+FFMPEG播放视频数据", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 26, listView);
	new CommonListViewItem("播放并录制RTSP流(摄像机)", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 27, listView);
	new CommonListViewItem("多路音视频监控项目", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 28, listView);

}

FFMpegWindow::~FFMpegWindow()
{
}
